<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引包 -->
    <script src="../js/vue.js"></script>
</head>
<body>
    <!-- 容器|模板 -->
    <div id="app">
        请输入你的姓：<input type="text" v-model="xing">
        请输入你的名：<input type="text" v-model="ming">
        <p>这个人的全称：{{allName}}</p>
        <button @click="handle">点击</button>
    </div>
</body>
</html>
<script>
     //关联VM
     const VM = new Vue({
         el:'#app',
         data:{
             xing:'',
             ming:''
         },
         methods:{
             handle(){
                 this.allName = '小花'
             }
         },
         computed:{
             allName:{
                 get(){
                    return this.xing + this.ming
                 },
                 set(val){
                     let arr = val.split("")
                     this.xing = arr[0]
                     this.ming = arr[1]

                 }
             }
         },
         
     })
</script>